import { BaseController, CoolController } from "@cool-midway/core";
import { Get, Inject, Post } from "@midwayjs/core";
import { CommentInviteEntity } from "../../entity/invite";
import { CommentInviteService } from "../../service/invite";

@CoolController({
    api: [],
    entity: CommentInviteEntity,
    service: CommentInviteService,
})
export class ProviderCommentInviteController extends BaseController {
    @Inject()
    commentInviteService: CommentInviteService;

    @Post('/generate', { summary: '生成或刷新我的评论邀请码' })
    async generate() {
        return this.ok(await this.commentInviteService.generateInviteCode());
    }

    @Get('/mine', { summary: '获取我的评论邀请码' })
    async mine() {
        return this.ok(await this.commentInviteService.getMyInvite());
    }
}

